# __HEADER__

"""XXX"""

import ldap.dn

def compare_rdn(a, b):
    a = ldap.dn.explode_rdn(a)
    b = ldap.dn.explode_rdn(b)
    a.sort()
    b.sort()
    return cmp(a,b)

def compare_dn(a, b):
    a = ldap.dn.explode_dn(a)
    b = ldap.dn.explode_dn(b)

    a = map(ldap.dn.explode_rdn, a)
    map(lambda x: x.sort(), a)

    b = map(ldap.dn.explode_rdn, b)
    map(lambda x: x.sort(), b)

    return cmp(a,b)


